<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>猛猛小蚂蚁</title>
    <link rel="shortcut icon" href="#"/>
    <script src="https://cdn.bootcss.com/jquery/2.1.1/jquery.min.js"></script>
</head>
<body>
上传图片：
<form action="/upload" method="post" enctype="multipart/form-data">
    <input type="file" name="pic">
    <input type="submit">
</form>
<p onclick="send_ajax()">点击发送</p>
<script>
    function send_ajax() {
        // 发送ajax
        $.ajax({
            url: 'http://127.0.0.1:5000',
            data: JSON.stringify({'username': '猛猛小蚂蚁'}),
            dataType: 'json',
            type: 'POST',
            contentType: 'application/json',
            success: function (data) {
                alert('成功！')
            }
        })
    }
</script>
</body>
</html>